Handling of messages in a message system

ABSTRACT

A messaging system comprises a message source, a message receiver and a message service. The message service is intermediate of the message source and message receiver, and a compensation component is established at the message source. A one way message is transmitted from the message source, where the one-way message is part of a plurality of one way messages of an overall business transaction. The message is received at the message service and is transmitted to the message receiver, which processes the received message. The message receiver transmits a communication indicating success or failure of the processing of the message. The system causes compensation logic defined by a compensation component to execute responsive to receiving an indication of a failure of part of the overall business transaction despite the communication from the message receiver indicated that processing of the particular one way message succeeded.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No. 12/578,804, filed Oct. 14, 2009, entitled “METHOD OF HANDLING A MESSAGE”, now allowed, which claims priority to European Patent Application No. 08166551.5, filed Oct. 14, 2008, the disclosures of which are incorporated herein by reference.

BACKGROUND

Embodiments of this invention relates to handling a message in a message computer system, and more specifically, embodiments of the invention relate to providing an automated application execution guarantee for one-way messages using transactions.

In messaging systems, the use of messages and message queues in a wider network provide an asynchronous communications protocol, which means that the sender and receiver of a message do not need to interact with a message queue at the same time. Messages placed onto a queue are stored until a recipient retrieves them. Such networks support the passing of messages between different computer systems, connecting multiple applications and multiple operating systems. Messages can also be passed from queue to queue in order for a message to reach the ultimate desired recipient. An example of a commercial implementation of such messaging software is IBM's WebSphere MQ (previously MQ Series).

In a synchronous communication protocol, one system connects to another system, sends a request and waits for a reply. In many situations this is the ideal method of communicating. For example, a user sends a request or a web page and then waits for a reply. However, other systems exist in which such behaviour is not desirable. For example, an application may need to notify a different application that an event has occurred, but does not need to wait for a response. Another example occurs in publish/subscribe systems, where an application publishes a message for any number of clients to read. In both these examples it would not make sense for the sender of the information to have to wait for a reply, if, for example, one of the recipients had crashed.

Alternatively, an application run by a website, such as an online store, may need to respond to certain parts of a request immediately (such as telling the user that a purchase has been accepted), but may queue other parts such as the calculation of invoice amounts and the forwarding of data to the central accounting system, and so on) to be done some time later. In all these sorts of situations, having at least a subsystem which does asynchronous message queuing can help improve the performance of the overall system.

One way messages may be sent reliably and, using a transactional queuing system, may be sent as part of the requesting application's transaction. On the receiving side, a message may be received and executed as part of a separate transaction. Existing messaging systems support assured message “delivery” for asynchronous and time-independent one way communication between an application source and an application destination. Such a facility accommodates the possibilities of link failure and many other conditions that can arise in complex networks.

The receiver need not be available when a message is transmitted by the source and the communication path the message traverses may be across different execution environments (therefore traditional distributed atomic transactions are not appropriate for messaging). A typical model is that there are three participants, the message source, the messaging service and message receiver, each in a different transaction, with the messaging service middleware taking responsibility for delivering the messages reliably, between transactions.

Each participant may be doing other work, for example, performing database I/O, dealing with other messages or even taking part in a distributed synchronous transaction with other servers. Typically the message source places a message on a queue, and it is sent when the transaction is committed (i.e. the source hands the message to the transactional messaging service and when the message source commits the transaction the messaging service “persists” the message to be delivered to the receiving target so that it can be reliably delivered across any failure of the transport). The messaging service provider logically has a transaction that includes receiving the message from a persistent queue and placing the message on a queue designated for the message receiver. Finally, the message receiver (which may or may not be the message source) performs a transaction that includes retrieving the message from a queue and processing, the contents of the message (which might involve executing a business service). Such a method of operation is known as an ‘unshared-transaction’ between message source and message receiver.

SUMMARY

According to aspects of the present disclosure, a method of handling messages in a messaging system is provided. The method comprises receiving, by a message service, a particular one-way message that was transmitted by a message source as part of an overall business transaction comprising a plurality of one-way messages. The method also comprises communicating the particular one way message from the messaging service to a message receiver. Further, the method comprises receiving, by the message service, a communication indicating success or failure of the processing of the particular one way message by the message receiver. Still further, the method comprises causing compensation logic defined by a compensation component to execute responsive to receiving an indication of a failure of part of the overall business transaction despite the communication from the message receiver indicated that processing of the particular one way message succeeded.

According to still further aspects of the present invention, a method of handling messages in a messaging system is provided. The method comprises transmitting a particular one way message, as part of an overall business transaction, from a message source, where the overall business transaction comprises a plurality of one way messages, and receiving the particular one way message at a message service. The method also comprises transmitting the particular one way message from the messaging service and receiving the particular one way message at a message receiver. The method still further comprises processing the particular one way message at the message receiver and transmitting a communication from the message receiver, where the communication indicates success or failure of the processing of the particular one way message. Also, the method comprises receiving the communication at the messaging service. Yet further, the method comprises causing compensation logic defined by the compensation component to execute responsive to receiving an indication of a failure of part of the overall business transaction when the communication indicated that processing of the particular one way message succeeded.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

Embodiments of the present invention will now be described, by way of example only, with reference to the accompanying drawings, in which:

FIG. 1 is a schematic diagram of a messaging computer system according to an embodiment of the invention,

FIGS. 2 to 5 are process flow diagrams of message flow in the messaging system according to an embodiment of the invention, and

FIG. 6 is a flowchart of a method of operating the messaging system according to an embodiment of the invention.

DETAILED DESCRIPTION

FIG. 1 shows a messaging computer system, in a schematic representation. The messaging system comprises a message source 10, a message receiver 12 and a message service 14, which is intermediate of the message source 10 and the message receiver 12. A single message 16 is shown, firstly as the message 16 is transmitted from the message source 10 to the message service 14, and secondly as the message 16 is transmitted from the message service 14 to the message receiver 12. The system shown in FIG. 1 could be, for example, the back-end system of a retail website where users purchase goods. The message source 10 could be a server hosting the website, and when an action is initiated, such as a user making a purchase, then various messages 16 will be generated, for example, to update the user's account, to update stock records, to claim money from a third party account, and so on. The message receiver 12 could be a server that is maintaining the stock records, for example.

The system of FIG. 1 is modified to provide an improvement over known systems. Using transactions which support a long duration, loosely coupled interaction between sender and receiver, there is provided autonomic recovery and guaranteed execution capabilities, which are transparent to the existing messaging system. An implementation may consist either of an adapter that augments the existing messaging services implementation or modification of the existing messaging services to provide a shared transaction between the message source 10 and the message receiver 12.

The system may use nested transaction relationships in which the individual unshared transactions (each representing one leg of the overall message communication) are themselves child participants in a single distributed, shared parent transaction, as an example, “business activity” in WS-BA (web services business activity) parlance. Each successfully completed nested child transaction may have an associated compensating action that is driven in the event of an unsuccessful outcome of the overall business transaction. Context from each parent transaction is propagated to its immediate children. Additionally, compensation logic is provided to automate any necessary recovery required by the communication for the overall transaction between message source and message receiver. This is may be provided to the intermediate messaging service but equally may exist elsewhere and be triggered by the message service. The system also employs transaction protocol messages, specifically a completion message, to determine that any messages have not only been delivered but have also been successfully executed by the message receiver.

Using transactions that support a long-duration, loosely coupled interaction between the sender 10 and the receiver 12 provides a means to involve the outcome of the asynchronously, reliably-invoked target service in the requester's unit of work (as embodied by the message 16) and to provide autonomic recovery and guaranteed execution capabilities transparent to the existing messaging system. As mentioned above, an implementation may consist either of an adapter that augments the existing messaging service's implementation or a modification of the existing messaging services to provide a ‘shared-transaction’ between the message source 10 and the message receiver 12 within which the unshared transactions are subordinate participants.

The sequence diagram of FIG. 2 illustrates an example of the end-to-end-flows using a nested sequence. For simplicity, the sequence illustrates a single PUT from the messaging client 10, but a sequence of messages to a single receiver 12 or a series of messages to different receivers 12 are modelled in the same way. The message source 10 is shown on the left-hand side of the diagram, and the message receiver 12 is shown on the right-hand side, with the messaging service 14 in-between. The message service 14 is represented by a pair of queues 18.

TX1 represents the overall transaction under which the client 10 initiates all its work. TX1 is initiated on the client's behalf but is longer-running than the client application itself; TX1 has a child-participant transaction and is not actually committed until it receives the “completed” acknowledgement from its child, typically long after the client 10 has finished processing. A compensation component, which has been established by the messaging source 10, “PUT compensation handler”, is added to the TX1 activity if the PUT to the first queue 18 is successful. Later, if the overall TX1 activity fails, the “PUT compensation” is executed, and puts another (compensation) message on the queue 18 to instruct the target 12 to compensate anything it did on forward processing.

The messaging infrastructure, represented by a transaction management unit, creates a transaction, TX2, as a child-participant of TX1, and the message is delivered to the target queue 18 as part of TX2. TX2 itself has a child-participant transaction and so is not actually committed until it receives the “completed” acknowledgement from its own child-participant. No explicit compensation handler needs to be added for TX2, although TX2 is itself implicitly registered as a child-participant of TX1. The messaging infrastructure creates a transaction TX3, as a child-participant of TX2. Under this transaction the message is read from the destination queue 18 by the target application 12 and any business logic is executed. No explicit compensation handler needs to be added for TX3, although TX3 is itself implicitly registered as a child-participant of TX2.

If the work of the target 12 fails for reasons of transient resource unavailability then the message will be redelivered by the messaging system. When TX3 commits it send a “completed.” message to its parent TX2; this in turn triggers TX2 to send a “completed” message to its parent TX1. Once TX1 has successfully completed all its processing it sends its compensation handlers and child-participants a “close” message (not shown in the sequence diagram) to clean up. These in turn delegate this message onto any of their own child-participants.

If the overall transaction TX1 fails, for example because another message sequence, not shown, failed while running in parallel to this one, then any compensation handlers and child-participants are driven to compensate. In this scenario, the child-participants do not need to perform any explicit compensation handling; the only compensation handler that needs to do anything is the “PUT compensation handler” which puts a new message to the transmission queue 18 to ultimately drive a processing in the target 12 that will need to compensate for what it did under TX3.

FIG. 3 illustrates the similar situation to that shown in the sequence diagram of FIG. 2, but this time with the creation of two messages by the message source 10, from the application that is being run by that source 10. Any user action in relation to the application run by the message source 10 can create multiple messages, which need to be passed to and processed on the target message receiver 12. These two messages are put onto a first queue 18 in the messaging service, which creates the first transaction TX1. The messaging source 10 will establish a corresponding compensation component for the messages.

The transaction management unit, of the messaging service, wilt then create two parallel child transactions TX2 and TX2′, one for each of the original messages. This results in the passing of the respective messages to a second queue 18. The notification and getting of the messages from the second queue 18 to the ultimate target message receiver 12 in turn creates two further parallel child transactions TX3 and TX3′. Although these are shown as dealing with the same target 12, they may have different message receivers 12 as the target consumer of the messages.

At the start of the process, the message source 10 also establishes the compensation component, and this component covers the necessary actions required if either of the messages fail to be processed by the target 12, whatever the reason for that failure. In the example of FIG. 3, both of the transactions TX3 and TX3′ are performed successfully, and the units of work are committed as transactions, and each child transaction will result in the parent transaction being completed back to the original transaction TX1. This ensures that the transaction created as a result of the original receipt of the messages from the message source 10 is completed, and the asynchronous work generated by the messages is known to the messaging service to have been completed. The compensation component could be provided to the messaging service or may exist elsewhere and be triggered by the messaging service as necessary.

FIG. 4, however, shows the traffic that occurs when a failure takes place. The failure in this sequence diagram occurs in relation to the transaction TX3′. In this example, the target 12 was unable to execute the piece of work embodied by the second message, of the two messages originally provided by the message source 10 to the messaging service. The reason for the failure is not material to the operation of the overall messaging system. In the example of FIG. 1, the target message receiver 12 was a server running a stock record. The failure of the processing of the message associated with the transaction TX3′ could be, for example, that since the user made the order, the item that the user wishes to purchase is now no longer in stock.

As a result of the failure of the target message receiver 12 to process the message, the TX3′ transaction will return a fail communication. This fail communication, shown as the arrow marked “failed” in the sequence diagram of FIG. 4, will be passed to the parent transaction TX2′. This causes the parent transaction TX2 to fail. In a similar fashion, the parent transaction TX2′ also return a fail communication, again shown as the arrow “failed”, and transaction TX1 will also fail. The total result of this fail communication trail is that the transaction management unit in the message service may register a fail condition for the entire transaction, indicating therefore that the work embodied by the specific message has not been carried out.

Upon receiving the fail communication at the messaging service, and because the communication indicates a failure of the processing of the work embodied by the second message, the messaging service is arranged to execute the compensation component, for example by transmitting a new message to the target message receiver 12. The compensation logic that was supplied with the original messages, shown as the arrow “AddPutCompensation” in the sequence diagram, provides the recovery function in the asynchronous process of handling the message.

The processing that occurs in the system following the failure communication reaching the transaction management unit is illustrated by the sequence diagram of FIG. 5. This diagram is augmented by a compensation handler 20, which is part of the message service, and may be located, for example, within the functionality of the transaction management unit. The compensation handler 20 is responsible for initiating the actions that will “repair” any damage caused by the failure of the processing of one or more of the original message(s) when the processing of work related to one message sent in the same transaction has succeeded. The compensation handler 20 can be added to an existing messaging system, in order to embody the functionality that is required in the improved asynchronous messaging system.

The nature of the compensation will be specific to the character of the work that was embodied by the message that failed. For example, the execution of the compensation component may specify reversal of certain actions taken, or may specify new actions. For example, the original message might be to order an item from a merchant and a second message might be an instruction to draw money from a customer's third party account. If the operation triggered by the second message fails through lack of funds in the customer's account, then compensation logic defined by the compensation component, sent by the compensation handler 20, may denote an excess charge to the user's account and a cancellation of the original order. The operation of the messaging service is not such that it is determining what compensation should take place, the originating message source 10 specifies the compensation component.

If the compensation handler 20 has executed the compensation component and been instructed to transmit a compensation message to the message receiver 12, then the compensation handier 20 will place the relevant compensation message onto a queue 18 within the messaging service. This compensation message will then flow through the messaging service like any other message, until it reaches the target message receiver 12. Child transactions will be created as the compensation message passes through individual queues 18 within the messaging service, as can be seen by the child transactions TXC2 and TXC3 within the sequence diagram. The message receiver 12 receives the compensation message and processing of the compensation message takes place at the message receiver 12. This transaction is committed once completed, and completion messages flow back through the message service, through the child transactions, to confirm that the compensation has been carried out successfully.

The method of operating the overall messaging system is summarised in FIG. 6. This Figure shows a flowchart of the processing that occurs after the generation of the message 16, at an application that is being run by the message source 10. After an action is initiated at the message source 10, then the first step of the method is the step S1 of transmitting the message 16 from the message source 10 to the message service 14. The message is part of a business transaction comprising a plurality of messages. At the same time, step S2 is performed, which comprises establishing the compensation component at the message source 10. The compensation logic may also be transmitted to the message service or may be registered elsewhere.

The third step, step S3, is the step of receiving the message 16 at the message service 14, and transmitting the message 16 from the messaging service 14. As discussed above, the receipt and transmittal of the message 16 by the messaging service 14 may include passing the message 16 through intermediate nodes of the messaging service 14, where such nodes may be queues 18, for example.

The next step S4 is the step of receiving the message 16 at the message receiver 12, and processing the message 16 at the message receiver 12. The receipt by the message receiver 12 of the message 16 may be achieved by the messaging service 14 informing the receiver 12 that a message 16 is available on a specific queue 18, and the message receiver 12 will get the message 16 from that queue 18 when the receiver 12 is ready to perform the processing of the specific message 16.

Once the processing of the message 16 has been successfully completed, or has failed, then the next step is the step S5 of transmitting a communication from the message receiver 12, the communication indicating success or failure of the processing of the message 16. This communication is used so that the transaction protocols being used in the system will have a guarantee of execution of the original message 16, not just of the delivery of the message 16. In the explanation of the messaging system, for clarity purposes, the term “message” has been used to mean the unit of work passed to the message receiver 12, and “communication” has been used to mean the confirmation passed back from the message receiver 12. However, in the context of a messaging system the “message” and “communication” will both be of the same format and will be handled in the same way. Different terms have been used to clearly indicate which is meant in the explanation.

The next step is the step S6 of receiving the communication at the messaging service 14. An indication of success or failure is then provided to the message source. An indication may also be received to indicate failure of the overall business transaction. If the overall business transaction failed when processing of the original message succeeded, then, the final step S7 of executing the compensation component is carried. This execution may comprise the generation of a new compensation message(s), depending upon the nature of the failure, for transmitting to the message receiver 12. The message receiver 12 will receive the compensation message and process that message. In this way, the messaging service 14 is aware that either the processing was successful (not just that the message 16 was delivered) or that the processing failed. If the processing failed, then there is an automatic handling of the compensation necessary to balance the error, without the need of any administrator intervention, nor needing to return to the originator of the message 16, the message source 10, which in an asynchronous system, will likely no longer be available.

As will be appreciated by one skilled in he art, the present invention may be embodied as a system, method or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment (including firmware, resident software, micro-code, etc.) or an embodiment combining software and hardware aspects that may all generally be referred to herein as a “circuit,” “module” or “system.” Furthermore, the present invention may take the form of a computer program product embodied in any tangible medium of expression having computer-usable program code embodied in the medium.

Any combination of one or more computer usable or computer readable medium(s) may be utilized. The computer-usable or computer-readable medium may be, for example but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, device, or propagation medium. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, or a magnetic storage device. Note that the computer-usable or computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted, or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory. In the context of this document, a computer-usable or computer-readable medium may be any medium that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. The computer usable program code may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc.

Computer program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider).

It will be appreciated that the embodiments of the invention as described will ensure that even if the original message source is disconnected from the message service, following the sending of the message, as will happen in an asynchronous system, there is a mechanism for dealing with the failure of a part of the overall business transaction, when the processing of the message (which was also part of that transaction actually succeeded. This is provided by the existence of the compensation component (established within the source), which is executed if needed, and can for example, trigger a subsequent message specifying a compensation action be preformed by the message receiver. The originating application at the message source preferably does not need to wait around in order to drive the compensation since the application delegates to the messaging service after the source tires and forgets the original message. The messaging source preferably pre-registers the compensation component with the messaging system.

Furthermore, it is understood that the messaging service comprises one or more queues and the step of receiving the message at the message service comprises receiving the message at a queue. Where the messaging service comprises a plurality of queues the method further comprises receiving and transmitting the message by two or more queues in turn. In a preferred embodiment, there is performed a transaction confirmation for each queue of the two or more queues in turn. Each movement of the message through the message service creates a transaction, which can be considered as creating each time a child transaction to the previous transaction, effectively creating a nested series of transactions. This enables the transaction unit to be in a position that it is made aware that each hop of the message through the message service to be completed, and that the ultimate processing of the message has also been completed. Each transaction is committed if successful or returns a fail communication if not.

Also, as described the method further comprises receiving a compensation message at the message receiver and processing the compensation message at the message receiver. The compensation component, once executed, can generate a compensation message, which can be sent to the original message receiver (or a different message receiver), in order for that message consumer to process the compensation message and carry out the necessary actions required to correct the situation that has arisen following the failure of the processing of the business transaction. This means that any changes that need to be made, in relation to the service delivered by the message receiver, can be carried out in the most efficient manner.

According to a first embodiment of the invention, there is provided a method of handling a message in a messaging system, the messaging system comprising a message source, a message receiver and a message service intermediate of the message source and message receiver, wherein a compensation component is established at the message source, the method comprising the steps of: transmitting a one way message, as part of a business transaction, from the message source, the transaction comprising a plurality of one way messages, receiving the message at the message service, transmitting the message from the messaging service, receiving the message at the message receiver, processing the message at the message receiver, transmitting a communication from the message receiver, the communication indicating success or failure of the processing of the message, receiving the communication at the messaging service, and responsive to receiving an indication of a failure of part of the transaction when the communication indicated that processing of the one way message succeeded, causing compensation logic defined by the compensation component to execute.

According to another aspect of an embodiment of the invention there is provided a messaging system comprising a message source, a message receiver and a message service intermediate of the message source and message receiver, wherein a compensation component is established at the message source, wherein: the message source is arranged to transmit a one way message, wherein the one way message is part of a business transaction, the business transaction comprising a plurality of one way messages, the message service is arranged to receive the message and to transmit the message, the message receiver is arranged to receive the message, to process the message, and to transmit a communication, the communication indicating success or failure of the processing of the message, and the messaging service is arranged to receive the communication, the message service being, responsive to receiving an indication of a failure of part of the transaction when the communication indicated that processing of the one way message succeeded, operable to cause compensation logic defined by the compensation component to execute.

According to a another aspect of an embodiment of the invention, there is provided a method of operating a message source comprising: initiating an action, transmitting a one way message from the message source, in response to the action, the one way message being part of a business transaction comprising a plurality of one way messages and establishing a compensation component at the message source, the compensation component defining actions to be taken, if the processing of the message succeeds, whilst the processing of a part of the transaction fails.

According to another aspect of an embodiment of the invention, there is provided a message source arranged to initiate an action, to transmit a one way message from the message source, in response to the action, the one way message being part of a business transaction comprising a plurality of one way messages, the message source being further arranged to establish a compensation component at the message source, the compensation component defining actions to be taken, if the processing of the message succeeds, whilst the processing of a part of the transaction fails.

According to another aspect of an embodiment of the invention, there is provided a computer program product on a computer readable medium for operating a message source, the product comprising instructions for: initiating an action, transmitting a one way message from the message source, in response to the action, the one way message being part of a business transaction comprising a plurality of one way messages, and establishing a compensation component at the message source, the compensation component defining actions to be taken, if the processing of the message succeeds whilst the processing of a part of the transaction fails.

According to a sixth aspect, there is provided a method of operating a message service in a messaging system, the messaging system comprising a message source, a message receiver and the message service intermediate of the message source and message receiver, the method comprising steps of: receiving a one way message, as part of a business transaction, from the message source, the transaction comprising a plurality of one way messages, transmitting the message from the messaging service to the message receiver for processing thereat, receiving a communication from the message receiver, the communication indicating success or failure of the processing of the message, and responsive to receiving an indication of a failure of part of the transaction when the communication indicated that processing of the one way message succeeded, causing compensation logic defined by a compensation component established at the message source to execute.

According to another aspect of an embodiment of the invention, there is provided a message service, operable in a messaging system, the messaging system comprising a message source, a message receiver and the message service intermediate of the message source and message receiver, the apparatus comprising: means for receiving a one way message, as part of a business transaction, from the message source, the transaction comprising a plurality of one way messages, means for transmitting the message from the messaging service to the message receiver for processing thereat, means for receiving a communication from the message receiver, the communication indicating success or failure of the processing of the message, and means, responsive to receiving an indication of a failure of part of the transaction when the communication indicated that processing of the one way message succeeded, for causing compensation logic defined by a compensation component established at the message source to execute.

The method and system ensure that even if the original message source is disconnected from the message service, following the sending of the message, as will happen in an asynchronous system, there is a mechanism for dealing with the failure of a part of the overall business transaction, when the processing of the message (which was also part of that transaction) actually succeeded. This is provided by the existence of the compensation component (established within the source), which is executed if needed, and can for example, trigger a subsequent message specifying a compensation action be performed by the message receiver. The originating application at the message source preferably does not need to wait around in order to drive the compensation since the application delegates to the messaging service after the source fires and forgets the original message. The messaging source preferably pre-registers the compensation component with the messaging system.

In one embodiment, the method further comprises receiving a compensation message at the message receiver and processing the compensation message at the message receiver. The compensation component, once executed, can generate a compensation message, which can be sent to the original message receiver (or a different message receiver), in order for that message consumer to process the compensation message and carry out the necessary actions required to correct the situation that has arisen following the failure of the processing of the business transaction. This means that any changes that need to be made, in relation to the service delivered by the message receiver, can be carried out in the most efficient manner.

In one embodiment, the messaging service comprises a transaction management unit and the method further comprises receiving the compensation component at the transaction management unit. The use of transaction management functionality within the messaging system supports effective implementation of a number of desired features such as the monitoring of the delivery and execution of messages.

Ideally, the messaging service comprises one or more queues and the step of receiving the message at the message service comprises receiving the message at a queue. Where the messaging service comprises a plurality of queues the method further comprises receiving and transmitting the message by two or more queues in turn. In a preferred embodiment, there is performed a transaction confirmation for each queue of the two or more queues in turn. Each movement of the message through the message service creates a transaction, which can be considered as creating each time a child transaction to the previous transaction, effectively creating a nested series of transactions. This enables the transaction unit to be in a position that it is made aware that each hop of the message through the message service to be completed, and that the ultimate processing of the message has also been completed. Each transaction is committed if successful or returns a fail communication if not. 

1. A computer readable storage medium having computer readable program code stored thereon, wherein the program code is executed to handle messages in a messaging system, comprising: receiving, by a message service, a particular one-way message that was transmitted by a message source as part of an overall business transaction comprising a plurality of one-way messages; communicating the particular one way message from the messaging service to a message receiver; receiving, by the message service, a communication indicating success or failure of the processing of the particular one way message by the message receiver; and causing compensation logic defined by a compensation component to execute responsive to receiving an indication of a failure of part of the overall business transaction despite the communication from the message receiver indicated that processing of the particular one way message succeeded.
 2. The computer readable storage medium of claim 1 further comprising: implementing the overall business transaction as a loosely coupled interaction between the message service and the message receiver that is longer-running in duration than a client, such that the overall business transaction is initiated on the client's behalf.
 3. The computer readable storage medium of claim 1 further comprising: processing the overall business transaction using nested transaction relationships in which individual unshared transactions are child participants in a single distributed, shared parent transaction.
 4. The computer readable storage medium of claim 3 further comprising providing successfully completed nested child transactions with an associated compensating action that is driven in the event of an unsuccessful outcome of the overall business transaction.
 5. The computer readable storage medium of claim 3 further comprising propagating context from a parent transaction to immediate children of the corresponding parent transaction.
 6. The computer readable storage medium of claim 1 further comprising generating a transaction protocol message comprising a completion message that determines that messages have been delivered to and successfully executed by the message receiver.
 7. The computer readable storage medium of claim 1 further comprising providing a first queue and a second queue; wherein: receiving, by a message service, a particular one-way message comprises receiving the particular one way message at the first queue such that the compensation logic defined by the compensation component is added to a message activity if the particular one way message is successfully received into the first queue; and communicating the particular one way message from the messaging service to a message receiver comprises creating a second message as a child-participant of the particular one way message, which is placed in the second queue and reading, by the message receiver, the child-participant of the particular one way message from the second queue.
 8. The computer readable storage medium of claim 7, wherein: receiving, by the message service, a communication indicating success or failure of the processing of the particular one way message comprises sending a completed message to the child-participant in the second queue indicating success, which causes the child-participant in the second queue to send a completed message to the particular one way message in the first queue; further comprising: sending the compensation logic and the child-participant a close message to clean up the now completed sequence.
 9. The computer readable storage medium of claim 8, wherein causing compensation logic defined by the compensation component to execute responsive to receiving an indication of a failure of part of the overall business transaction when the communication indicated that processing of the particular one way message succeeded comprises detecting that the overall business transaction, comprises: detecting that a second one-way message of the overall business transaction failed, which is being processed in parallel to the particular one-way message; and driving the compensation logic and the child-participant to compensate.
 10. The computer readable storage medium of claim 7, wherein: receiving, by the message service, a communication indicating success or failure of the processing of the particular one way message by the message receiver comprises sending a completed message to the child-participant in the second queue indicating failure; and causing compensation logic defined by the compensation component to execute responsive to receiving an indication of a failure of part of the overall business transaction despite the communication indicated that processing of the particular one way message succeeded, comprises executing the compensation logic added to a message activity and putting a compensation message in the second queue that instructs the message receiver to compensate actions of the message receiver on forward processing.
 11. A computer readable storage medium having computer readable program code stored thereon, wherein the program code is executed to handle messages in a messaging system, comprising: transmitting a particular one way message, as part of an overall business transaction, from a message source, the overall business transaction comprising a plurality of one way messages; receiving the particular one way message at a message service; transmitting the particular one way message from the messaging service; receiving the particular one way message at a message receiver; processing the particular one way message at the message receiver; transmitting a communication from the message receiver, the communication indicating success or failure of the processing of the particular one way message; receiving the communication at the messaging service; and causing compensation logic defined by the compensation component to execute responsive to receiving an indication of a failure of part of the overall business transaction when the communication indicated that processing of the particular one way message succeeded.
 12. The computer readable storage medium of claim 11 further comprising: implementing the message source as a first server and implementing the message receiver as a second server as part of a back-end system of a website.
 13. The computer readable storage medium of claim 11 further comprising: processing the overall business transaction using nested transaction relationships in which individual unshared transactions are child participants in a single distributed, shared parent transaction.
 14. The computer readable storage medium of claim 13 further comprising providing successfully completed nested child transactions with an associated compensating action that is driven in the event of an unsuccessful outcome of the overall business transaction.
 15. The computer readable storage medium of claim 13 further comprising propagating context from a parent transaction to immediate children of the corresponding parent transaction.
 16. The computer readable storage medium of claim 11 further comprising generating a transaction protocol message comprising a completion message that determines that messages have been delivered to and successfully executed by the message receiver.
 17. The computer readable storage medium of claim 11 further comprising providing a first queue and a second queue; wherein: receiving the particular one way message at a message service comprises receiving the particular one way message at the first queue such that the compensation logic defined by the compensation component is added to a message activity if the particular one way message is successfully received into the first queue; and receiving the particular one way message at a message receiver comprises creating a second message as a child-participant of the particular one way message, which is placed in the second queue and reading, by the message receiver, the child-participant of the particular one way message from the second queue.
 18. The computer readable storage medium of claim 17, wherein: transmitting a communication from the message receiver, the communication indicating success or failure of the processing of the particular one way message comprises sending a completed message to the child-participant in the second queue indicating success, which causes the child-participant in the second queue to send a completed message to the particular one way message in the first queue; further comprising: sending the compensation logic and the child-participant a close message to clean up the now completed sequence.
 19. The computer readable storage medium of claim 18, wherein causing compensation logic defined by the compensation component to execute responsive to receiving an indication of a failure of part of the overall business transaction when the communication indicated that processing of the particular one way message succeeded comprises detecting that the overall business transaction, comprises: detecting that a second one-way message of the overall business transaction failed, which is being processed in parallel to the particular one-way message; and driving the compensation logic and the child-participant to compensate.
 20. The computer readable storage medium of claim 17, wherein: transmitting a communication from the message receiver, the communication indicating success or failure of the processing of the particular one way message comprises sending a completed message to the child-participant in the second queue indicating failure; and causing compensation logic defined by the compensation component to execute responsive to receiving an indication of a failure of part of the overall business transaction despite the communication indicated that processing of the particular one way message succeeded, comprises executing the compensation logic added to a message activity and putting a compensation message in the second queue that instructs the message receiver to compensate actions of the message receiver on forward processing. 